package com.onedec.apply.service.impl;

import com.onedec.apply.entity.OnedecApply;
import com.onedec.apply.mapper.OnedecApplyMapper;
import com.onedec.apply.service.OnedecApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class OnedecApplyServiceImpl implements OnedecApplyService {
    @Autowired
    private OnedecApplyMapper onedecApplyMapper;
    @Override
    public void insert(OnedecApply onedecApply) {
        onedecApplyMapper.insertSelective(onedecApply);
    }

    @Override
    public int selectQunzhuId(int id) {
        return onedecApplyMapper.selectQunzhuId(id);
    }

    @Override
    public void updateById(int id) {
        OnedecApply onedecApply = onedecApplyMapper.selectByPrimaryKey(id);
        onedecApply.setApplyStatus("1");
        onedecApplyMapper.updateByPrimaryKeySelective(onedecApply);
    }

    @Override
    public List<Map<String, Object>> selectByMap(Map<String, Object> map) {
        return onedecApplyMapper.selectByMap(map);
    }

    @Override
    public long accountnum() {
        return onedecApplyMapper.countByExample(null);
    }

    @Override
    public void rejectById(int id) {
        OnedecApply onedecApply = onedecApplyMapper.selectByPrimaryKey(id);
        onedecApply.setApplyStatus("3");
        onedecApplyMapper.updateByPrimaryKeySelective(onedecApply);
    }

}
